package com.cdl.maptest;

import java.util.HashMap;
import java.util.Map;

public class MapDemo1 {
    public static void main(String[] args) {

        Map<String, Integer> map = new HashMap<>();

        map.put("one", 1);
        map.put("two", 2);
        map.put("three", 3);
        map.put("four", 4);
        map.put("five", 5);
        map.put("six", 6);
        map.put("sit",1123);

        System.out.println(map);

        boolean flg = map.containsKey("five");
        System.out.println(flg);
        System.out.println(map.containsValue(4));

        map.keySet().forEach(System.out::println);
        map.values().forEach(System.out::println);

        for (String key : map.keySet()) {
            System.out.println(key + ":" + map.get(key));
        }

        for (Integer i : map.values()) {
            System.out.println(i);
        }

        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            System.out.println(entry.getKey() + ":" + entry.getValue());
        }


    }
}
